import 'dart:async';

import 'package:flutter/cupertino.dart';
import 'package:flutter_demo/model/timer_model.dart';

class TimerViewModel extends ChangeNotifier {
   final List<TimerModel> list = [TimerModel(1739254718264), TimerModel(1739255818264), TimerModel(1739254618264)];

   TimerViewModel() {
      Timer.periodic(const Duration(seconds: 5), (timer) {
         _calculate();
      });
   }

   _calculate() async {
      for (var element in list) {
         element.calculateTimeDifference();
      }
      notifyListeners();
   }
}